<template>
   <div>
       {{data}}
   </div>
</template>

<script>
   export default {
       data () {
       return {
           data: []
       }
   },
   created(){
    //    将两个请求一起发送 只要有一个失败 就是失败 全体成功才能成功
        function getMsg(res1,res2){
            console.log('成功请求');
            console.log(res1);
            console.log(res2);
        }
        this.$axios.all([
            this.$axios.post('http://127.0.0.1:3000/search','key=万达'),
            this.$axios.get('http://127.0.0.1:3000/movieslist')
        ])
        .then(this.$axios.spread(getMsg))
        .catch(err=>{
            console.log(err)
        })
   }
 }
</script>

<style>
 
</style>
